From 52878c45b5303291be355232d2567f822b18529a Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Wed, 4 Aug 2010 11:43:18 +0200 Subject: [PATCH] GtkCssProvider: Don't jump too eagerly to the next element when comparing selectors. --- gtk/gtkcssprovider.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/gtk/gtkcssprovider.c b/gtk/gtkcssprovider.c index 692de7831a..7f83d1b304 100644 --- a/gtk/gtkcssprovider.c +++ b/gtk/gtkcssprovider.c @@ -442,7 +442,20 @@ compare_selector (GtkWidgetPath *path, elem = elements->data; match = compare_selector_element (path, i, elem, &elem_score); - i++; + + /* Only move on to the next index if there is no match + * with the current element (whether to continue or not + * handled right after in the combinator check), or a + * GType or glob has just been matched. + * + * Region and widget names do not trigger this because + * the next element in the selector path could also be + * related to the same index. + */ + if (!match || + (elem->elem_type == SELECTOR_GTYPE || + elem->elem_type == SELECTOR_GLOB)) + i++; if (!match && elem->elem_type != SELECTOR_TYPE_NAME && -- 2.30.2